package com.gszy.auth.dao;

import com.gszy.auth.database.BeanHandler;
import com.gszy.auth.database.JdbcTemplate;
import com.gszy.auth.entity.Role;

import java.util.List;

public class RoleDao {

    public List<Role> findRolesByUserId(String userId){

        String sql = "select * from role where id in (select role_id from where user_id=?)";

        return new JdbcTemplate().queryForList(
                sql,
                new BeanHandler<>(Role.class),
                userId
        );
    }
}
